const info: {
  name: string
  age: number
} = { name: "why", age: 18 }

const info1: { name: string; age: number } = { name: "why", age: 18 }
const info2: { name: string, age: number } = { name: "why", age: 18 }

// 对象类型和函数类型结合使用
type PointType = { x: number, y: number, z?: number }
function printCoordinate(point: PointType) {
  console.log("x坐标:", point.x)
  console.log("y坐标:", point.y)
  if (point.z) console.log("z坐标:", point.z)
}

printCoordinate({ x: 10, y: 20 })
printCoordinate({ x: 100, y: 200, z: 300 })